package com.hongning.railway.ui.main.cadremanager.itemviewmodel;

import android.databinding.ObservableField;
import android.support.annotation.NonNull;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;

import com.hongning.railway.entity.reqbean.ReqMemberList;
import com.hongning.railway.entity.resbean.ResMemberInfo;
import com.hongning.railway.ui.main.cadremanager.CadreGradeFragmentViewModel;

import java.util.Observable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import me.goldze.mvvmhabit.base.ItemViewModel;
import me.goldze.mvvmhabit.utils.ToastUtils;

/**
 * Author: zhangjing
 * DATA:2019-08-29 17:05
 * DESC:
 * email:zhangjingworkmol@163.com
 */
public class CadreGradeItemViewModel extends ItemViewModel<CadreGradeFragmentViewModel> {
    ResMemberInfo data;
    public ObservableField<String> socre = new ObservableField<>();
    public ObservableField<String> name = new ObservableField<>();
    public ObservableField<Boolean> inputfilter = new ObservableField<>(true);

    public CadreGradeItemViewModel(@NonNull CadreGradeFragmentViewModel viewModel,ResMemberInfo resMemberInfo) {
        super(viewModel);
        this.data=resMemberInfo;
        name.set(data.getUsername());
        if (resMemberInfo.getEvaluationscore()!=null){
            socre.set(resMemberInfo.getEvaluationscore());
        }
    }
    public ReqMemberList.Data getData(){
        ReqMemberList.Data resdata = new ReqMemberList.Data();
        resdata.setUserid(data.getUserid());
        resdata.setUsername(data.getUsername());
        resdata.setEvaluationscore(socre.get());
        return resdata;
    }
}
